home *** CD-ROM | disk | FTP | other *** search
- /* %filename% -- document methods */
- /* Created %date% %time% by AppMaker */
-
- /* We recommend that you not modify this module and instead modify */
- /* its subclass, %Appname%Doc. The 'z' prefix on this module marks% %*/
- /* a module which is likely to be regenerated by AppMaker after you */
- /* make changes to the user interface. The modules without the 'z' */
- /* prefix will not be regenerated by AppMaker unless you delete them. */
- /* Using a separate subclass to override the AppMaker-generated code */
- /* lets you regenerate code without losing your hand-coded changes. */
-
- #include <Commands.h>
- #include <Global.h>
- #include <CApplication.h>
- #include <CBartender.h>
- #include <CDataFile.h>
- #include <CDesktop.h>
- #include <CError.h>
- #include <TBUtilities.h>
- #include "ResourceDefs.h"
- #include "%appname%Data.h"
- %if fileExists appname+Doc.c%
- %for each menu gen includeDocDialogs%
- %endif%
- %for each window gen include%
- #include "z%Appname%Doc.h"
-
- extern CApplication *gApplication; /* The application */
- extern CBartender *gBartender; /* The menu handling object */
- extern CError *gError; /* The error handling object */
-
- /*----------*/
- void Z%Appname%Doc::I%Appname%Doc% %(CApplication *aSupervisor,
- Boolean printable)
- {
- inherited::IDocument (aSupervisor, printable);
- itsData = NULL;
-
- } /* I%Appname%Doc */
-
- /*----------*/
- void Z%Appname%Doc::Dispose (void)
- {
- ForgetObject (itsData);
- itsFile = NULL; // was disposed by ForgetObject (itsData)
- inherited::Dispose ();
-
- } /* Dispose */
-
- /*----------*/
- void Z%Appname%Doc::NewFile (void)
- {
- itsData = new C%Appname%Data;
- itsData->I%Appname%Data (this);
-
- BuildWindows ();
-
- if (itsWindow != NULL) {
- itsWindow->Select ();
- }
-
- } /* NewFile */
-
- /*----------*/
- void Z%Appname%Doc::OpenFile (SFReply *macSFReply)
- {
- Str63 theName;
-
- itsData = new C%Appname%Data;
- itsData->I%Appname%Data (this);
- itsData->SFSpecify (macSFReply);
- itsData->OpenData (fsRdWrPerm);
- itsFile = itsData;
-
- BuildWindows ();
-
- itsFile->GetName (theName);
- if (itsWindow != NULL) {
- itsWindow->SetTitle (theName);
- itsWindow->Select ();
- }
-
- } /* OpenFile */
-
- /*----------*/
- void Z%Appname%Doc::BuildWindows (void)
- {
- CWindow *mainWindow;
- CDirector *subWindow;
-
- %for each window gen create%
-
- } /* BuildWindows */
-
- /*----------*/
- Boolean Z%Appname%Doc::DoSave (void)
- {
- if (itsFile == NULL) {
- return (DoSaveFileAs ());
- } else {
- if (itsData->Save ()) {
- dirty = FALSE;
- return (TRUE);
- } else {
- return (FALSE);
- }
- }
- } /* DoSave */
-
- /*----------*/
- Boolean Z%Appname%Doc::DoSaveAs (SFReply *macSFReply)
- {
- if (itsData->SaveAs (macSFReply)) {
- itsFile = itsData;
- if (itsWindow != NULL) {
- itsWindow->SetTitle (macSFReply->fName);
- }
- dirty = FALSE;
- return (TRUE);
- } else {
- return (FALSE);
- }
-
- } /* DoSaveAs */
-
- /*----------*/
- void Z%Appname%Doc::DoRevert (void)
- {
- itsData->Revert ();
- dirty = FALSE;
-
- } /* DoRevert */
-
- %if fileExists appname+Doc.c%
- /*----------*/
- /* This code should be in %Appname%Doc.c rather than in this file. */
- /* AppMaker generated it here because %Appname%Doc.c already existed. */
- /* AppMaker doesn't overwrite an existing non-Z file because it */
- /* might have lots of user hand-written code. */
- /*----------*/
- void Z%Appname%Doc::UpdateMenus (void)
- {
- inherited::UpdateMenus ();
- %for each menu gen updateDocMenus%
-
- } /* UpdateMenus */
-
- /*----------*/
- void Z%Appname%Doc::DoCommand (long theCommand)
- {
- switch (theCommand) {
- %for each menu gen handleDocItems%
-
- default:
- inherited::DoCommand (theCommand);
- break;
- } /* switch */
-
- } /* DoCommand */
-
- %endif%
- /* %filename% */
-